﻿#pragma once
#include <optional>
#include <SDL2/SDL_rect.h>
#include <string>

namespace engine
{
    namespace render
    {
        class Sprite
        {
        public:
            Sprite(const std::string& texturePath, std::optional<SDL_Rect> srcRect = std::nullopt, bool is_flipped_horizontally = false);
			~Sprite() = default;

            const std::string& getTextureID() const;
            const std::optional<SDL_Rect>& getSrcRect() const;
            bool isFlipped() const;

            void setTextureID(const std::string& textureID);
            void setSrcRect(const std::optional<SDL_Rect>& srcRect);
            void setFlipped(bool flipped);
        private:
			std::string m_textureID;                                    //纹理ID
            std::optional<SDL_Rect> m_srcRect;             //源矩形区域，nullopt表示使用整个纹理
			bool is_flipped = false;                                    //是否水平翻转       
		};
    }
}